package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.TourGroupMember;
import com.ruoyi.system.mapper.TourGroupMemberMapper;
import com.ruoyi.system.service.ITourGroupMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TourGroupMemberService implements ITourGroupMemberService {

    @Autowired
    private TourGroupMemberMapper TourGroupMemberMapper;

    @Override
    public List<TourGroupMember> selectMemberList() {
        return TourGroupMemberMapper.selectMemberList();
    }
    @Override
    public int addMember(TourGroupMember tourGroupMember) {
        try {
            TourGroupMemberMapper.addMember(tourGroupMember);
            System.out.println(tourGroupMember.getId());
            return tourGroupMember.getId();
        }catch (Exception e){
            e.printStackTrace();
            return 0;
        }
    }
    @Override
    public String updateMember(TourGroupMember tourGroupMember) {
        try {
            TourGroupMemberMapper.updateMember(tourGroupMember);
            return "修改成功！";
        }catch (Exception e){
            e.printStackTrace();
            return "修改失败";
        }
    }

    @Override
    public String deleteMember(Integer id) {
        try {
            TourGroupMemberMapper.deleteMember(id);
            return "删除成功！";
        }catch (Exception e){
            e.printStackTrace();
            return "删除失败";
        }
    }
}
